package com.icloud.common.database.enums;

import lombok.Getter;

@Getter
public enum IMMessageTypeEnum {
    FRIEND_APPLY("FRIEND_APPLY"), // 好友申请
    JOIN_GROUP_APPLY("JOIN_GROUP_APPLY"), // 加群申请
    INVITE_GROUP("INVITE_GROUP"); // 邀请入群

    private final String code;

    IMMessageTypeEnum(String code){
        this.code = code;
    }

    public static IMMessageTypeEnum byCode(String code) {
        for (IMMessageTypeEnum e: IMMessageTypeEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                return e;
            }
        }
        return null;
    }

    public static boolean isFriendApply(String code){
        return FRIEND_APPLY.code.equalsIgnoreCase(code);
    }
    public static boolean isJoinGroupApply(String code){
        return JOIN_GROUP_APPLY.code.equalsIgnoreCase(code);
    }
    public static boolean isInviteGroup(String code){
        return INVITE_GROUP.code.equalsIgnoreCase(code);
    }
}
